package com.heatingcharge.dto;

import cn.hutool.core.util.ObjectUtil;
import lombok.Data;

import java.math.BigDecimal;
import java.text.DecimalFormat;

@Data
public class ZoneClearOffDTO {
    /*
    小区数量
     */
    private Integer zoneCount;
    /*
    楼栋数量
     */
    private Integer buildingCount;
    /*
    住户数量
     */
    private Integer houseCount;
    /*
    总供热面积
     */
    private Integer totalHeatArea;
    /*
    总应收金额
     */
    private BigDecimal actualPayable;
    /*
    总实收金额
     */
    private BigDecimal actual;
    /*
    总欠费金额
     */
    private BigDecimal arrears;
    /*
    正常供暖户数
     */
    private Integer normal;
    /*
    报停户数
     */
    private Integer noticeStop;
    /*
    强停用户数
     */
    private Integer forceStop;
    /*
    未供户数
     */
    private Integer unHeated;
    /*
    已缴费户数
     */
    private Integer paid;
    /*
    未缴费户数
     */
    private Integer unPaid;
    /*
    缴费率
     */
    private float percentage;

    public float getPercentage() {
        if (ObjectUtil.isNotNull(paid)&&ObjectUtil.isNotNull(normal)){
            float v = (float) paid / normal * 100;
            return (float)(Math.round(v*100)/100);
        }
        return 0f;

    }
    private BigDecimal chargePercentage;

    public BigDecimal getChargePercentage() {
        if (ObjectUtil.isNotNull(actualPayable)&&ObjectUtil.isNotNull(actual)){
            BigDecimal b= actual.divide(actualPayable,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
            return b;
        }
        return new BigDecimal("0");

    }
}
